﻿using System;
using System.Configuration;

namespace ErrorDumper.Configuration {
    public class FilterRulePropertyConfigurationElement : ConfigurationElementCollection {
        
        [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
        public string Name {
            get { return (string)this["name"]; }
            set { this["name"] = value; }
        }

        protected override ConfigurationElement CreateNewElement() {
            return new FilterRuleValueConfigurationElement();
        }

        protected override object GetElementKey(ConfigurationElement element) {
            return ((FilterRuleValueConfigurationElement)element).Value;
        }

        internal bool ContainsValue(string value) {
            if (value == null)
                throw new ArgumentNullException("value");
            return BaseGet(value) != null;
        }
    }
}